﻿using Microsoft.CodeAnalysis.CSharp.Syntax;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using UMLSynthesizer.LangAnalyzer.Elements;
using UMLSynthesizer.LangAnalyzer.Statements;

namespace UMLSynthesizer.CSharpAnalyzer.Statements
{
    abstract class CSharpStatementBase : IStatementBase
    {
        #region Fields

        protected StatementSyntax statementNode;

        #endregion

        #region Constructor

        public CSharpStatementBase(StatementSyntax statementNode,
            IStatementBase parentStatement,
            IElementBase parentElement,
            StatementKinds kind)
        {
            if (parentStatement == null && parentElement == null)
                throw new ArgumentNullException("parentStatement && parentElement");

            this.statementNode = statementNode;
            this.ParentStatement = parentStatement;
            if (parentStatement != null)
                this.ParentElement = parentStatement.ParentElement;
            else
                this.ParentElement = parentElement;
            this.ProjectOwner = this.ParentElement.ProjectOwner;
            this.Kind = kind;
        }

        #endregion

        #region Properties

        public IStatementBase ParentStatement { get; protected set; }
        public IElementBase ParentElement { get; protected set; }
        public IProjectElement ProjectOwner { get; protected set; }
        public StatementKinds Kind { get; protected set; }

        #endregion
    }
}
